<template>
  <div class="about">
    <h1>This is an about page</h1>
     <input type="checkbox">舞蹈
       <input type="checkbox">篮球
      <input type="checkbox">rap
      <div >
        <input type="text" v-model="msg"> 
      </div>
      <h1>模拟登录</h1>
      <button @click="login">登录</button>
  </div>
</template>
<script>
// 进入组件 触发vuex的actions方法 隐藏菜单 

// 如果使用了keepAlive 的组件 首次进入触发beforeCreate，created
// beforeMount，mounted 和activated组件激活

// 离开组件 只触发deactivated 组件失活
// 在次进入 只触发 activated 组件激活

export default {
  data(){
    return {
      msg:""
    }
  },
  methods:{
    login(){
      localStorage.token="shfkashfksakfashfkashf"
      localStorage.powerCode=2;
      // 登录成功后跳转到首页
      this.$router.push("/home")
    }
  },
  beforeCreate() {
    console.log("beforeCreate")
  },
  created() {
    // console.log("created")
    //  this.$store.dispatch("actNav",false)
  },
  beforeMount(){
    console.log('beforeMount')
  },
  mounted() {
      console.log(' mounted')
  },
  activated() {
    console.log("组件激活")
   
  },
  deactivated() {
    console.log("组件失活")
  },
  beforeDestroy() {
    console.log("beforeDestroy")
  },
  destroyed() {
    console.log("destroyed")
  },
}
</script>
